package com.houxm.jbapu;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DBUtils {

	public static void close(PreparedStatement p) {
		if(p!=null) {
			try {
				p.close();
			} catch (SQLException e) {
				//抛出运行时异常
				throw new JbapuRuntimeException(e);
			}
		}
	}

	public static void close(Connection conn) {
		if(conn!=null) {
			try {
				conn.close();
			} catch (SQLException e) {
				throw new JbapuRuntimeException(e);
			}
		}
	}

	public static void close(ResultSet rs) {
		if(rs!=null) {
			try {
				rs.close();
			} catch (SQLException e) {
				throw new JbapuRuntimeException(e);
			}
		}
	}

}
